﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using log4net;
using Quartz;

namespace MvcApplication1
{

    public class CallbackJob : JobBase, IJob
    {
        static object objLock = new object();//锁定静态对象，否则对于轮训服务没有意思，因为它每次都会产生一个新的实例


        #region IJob 成员

        public void Execute(IJobExecutionContext context)
        {
            lock (objLock)
            {

                Logger.Info(context.JobDetail.Key.Name + DateTime.Now);
                Thread.Sleep(10000);
            }
        }

        #endregion
    }

    public class CallbackJob2 : JobBase, IJob
    {
        static object objLock = new object();//锁定静态对象，否则对于轮训服务没有意思，因为它每次都会产生一个新的实例
        #region IJob 成员

        public void Execute(IJobExecutionContext context)
        {
            lock (objLock)
            {

                Logger.Info(context.JobDetail.Key.Name + DateTime.Now);
                Thread.Sleep(20000);
            }
        }

        #endregion
    }

}